import React from 'react'
import { Select } from 'antd'
import { useSelector } from 'react-redux'
import { useDispatch } from 'react-redux'
import { getChannelList } from '@/store/actions/channel'
export default function Channel (props) {
  console.log(props, '123465798')
  const channels = useSelector((state) => state.channel)
  const dispatch = useDispatch()
  React.useEffect(
    () => {
      dispatch(getChannelList())
    },
    [dispatch]
  )
  return (
    <Select
      value={props.value}
      onChange={props.onChange}
      style={{ width: 200 }}
      allowClear
      placeholder="请选择频道">
      {channels.map((item) => (
        <Select.Option value={item.id} key={item.id}>
          {item.name}
        </Select.Option>
      ))}
    </Select>
  )
}
